import Taro, { Component } from "@tarojs/taro";
import { View, Text } from "@tarojs/components";
import "./index.scss";
import Appheader from "../../components/Appheader";
import Appbanner from "../../components/Appbannar";
import NaviGation from "../../components/navigation";

export default class Index extends Component {
  constructor() {
    super();
    this.state = {
      isScroll: false
    };
  }

  componentWillMount() {}

  componentDidMount() {}

  componentWillUnmount() {}

  componentDidShow() {}

  componentDidHide() {}

  config = {
    navigationBarTitleText: "首页"
  };
  bannerScroll = () => {
    // console.log("首页收到滚动事件");
    const isScroll = !this.state.isScroll;
    // console.log(isScroll);
    this.setState({
      isScroll
    });
  };
  render() {
    const { isScroll } = this.state;
    return (
      <View className="home">
        <Appheader className={isScroll ? "scroll" : ""} />
        <Appbanner swiperScroll={this.bannerScroll} className={isScroll ? "setbj" : ""} />
        <NaviGation />
      </View>
    );
  }
}
